/***************************************************************************
    scro - ???
    Copyright (C) 2004 Stefan Zidar

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to Free Software 
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    
    Stefan Zidar
    AUSTRIA
    steffed@gmx.net
****************************************************************************

****************************************************************************
* scro.h - contains very important stuff, defaults, defines, structs,...   *
*             please read also the readme file.                            *
****************************************************************************/

#ifndef SCRO_H_
#define SCRO_H_


#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include "yakwailog.hxx"

#include <stdlib.h>
#include <string.h>
#include <stdarg.h>

#define SCRO_VERSION "v0.3.99"
#define SCRO_TITLE "scro"
#define SCRO_CONF "scro.conf"

#define TICK_INTERVAL 15 /* length of a game cycle, in milli-seconds, used in TimeLeft() */

#define TRUE 1
#define FALSE 0
#define TWO 2
#define ESCAPE SDLK_ESCAPE
#define LEFT 4
#define STOP 5
#define RIGHT 6

#define KBD1     1
/*#define KBD2     2
#define MOUSE    3
#define JOYSTICK 4
#define PADDLE1_CTRL  KBD1
#define PADDLE2_CTRL  KBD2
#define MAXCTRL JOYSTICK*/

#define PLAYER1_LEFT  SDLK_LEFT
#define PLAYER1_RIGHT SDLK_RIGHT
#define PLAYER1_STOP  SDLK_DOWN
#define PLAYER1_FIRE  SDLK_UP
#define PLAYER_SPEED 3
#define FIRE_SPEED 5
#define MAX_OBJECTS 20	/* max 255 as unsigned chars are used */
#define XMAX 800
#define YMAX 600
#define VIDEO_MODE SDL_DOUBLEBUF | SDL_HWSURFACE | SDL_SRCALPHA
//#define VIDEO_MODE SDL_SWSURFACE
#define VIDEO_BITS 16
#define OKE_KEY SDLK_RETURN
#define DEFAULT_LOGLEVEL 2


// FIXME: the SLI related stuff should be in level.h...
#define SLI_ERROR_INVALIDLEVEL (char)-5
#define SLI_ERROR_LOADFAILURE (char)-6
#define SCRO_ERROR_TILES (char)-7

#define SCRO_CLI_EXIT 2




struct setup
{
	char id[3];
	int x;
	int y;
	unsigned char bpp;
	Uint32 flags;
	char games2win;
	char p1ctrl;
/* char soundEnabled; */
};

typedef struct 
{
	struct setup settings;
	char saveSettings;
	char *execPath;
	char *configFile;
	SDLKey p1Left;
	SDLKey p1Up;
	SDLKey p1Right;
	SDLKey p1Down;
	char *tempChar;
	SDL_Surface *iconPic;
	char *picFile;
	char *levelfile;
} Environment;



typedef struct 
{
	unsigned int id;
	unsigned int status;
	/* int x, y; */
	SDL_Rect rect;
} Object;


/* see doc/functions for descriptions */

//void restoreDefaults(void);
//void quitScro(char mode);
//void handleArgs(char argN, char *argT[]);
//void initEnv(void);
//Uint32 TimeLeft(void);
//void saveSettings(void);
//void loadSettings(void);
//void setControls(void);
//void initSound(void);
//void gameEngine(void);
//void generateNewObject(char id);
//void doObjectStuff(void);

/* declarations of variables starts here */
extern yakwailog logger;

extern SDL_Surface *slFont;
//SFont_Font *selFont;

extern SDL_Rect playerRect;

extern Object objectArray[MAX_OBJECTS];

extern SDL_Surface *screen;
extern SDL_Surface *badguy;
extern SDL_Surface *fire;

extern SDL_Event event;

extern char health;

extern Environment scro;
/* declarations of variables ends here */

#endif
